package com.LambdaDemo;

//推导lambda表达式
public class TestLambda {

    //2.静态内部类
//    static class Like implements NLike{
//        @Override
//        public void lambda() {
//            System.out.println("i live here 2");
//        }
//    }

    public static void main(String[] args) {
        //3.局部内部类
//        class Like implements NLike{
//            @Override
//            public void lambda() {
//                System.out.println("i live here 3 内部类");
//            }
//        }
        //向下引用 父类引用子类
//        NLike like = new Like();
        NLike like = null;
        //4.匿名内部类 new接口
        like = new NLike() {
            @Override
            public void lambda() {
                System.out.println("匿名内部类");
            }
        };
        //5.lambda表达式
        like = ()->{
            System.out.println("lambda表达式实现");
        };

        like.lambda();

    }
}
//函数式接口
interface NLike{
    void lambda();
}
//1.实现类
//class Like implements NLike{
//    @Override
//    public void lambda() {
//        System.out.println("i live here");
//    }
//}